home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_gen_elevcall.cog < prev    next >
Text File  |  1999-11-15  |  8KB  |  206 lines

  1. # Jones 3D Cog Script
  2. #
  3. # gen_ElevCall.cog
  4. #
  5. # This Cog controls one elevator that can be summoned to any number of floors
  6. # A cog must be placed at each floor to be attached to the call button, the up and down
  7. # buttons, and the elevator.
  8. # You have to manually assign to each cog what floor level it is on.
  9. # Remember that the elevator's first frame is 0 even though your first floor may be one.
  10. #
  11. # [SxC]
  12. #
  13. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  14. # ========================================================================================
  15.  
  16.  
  17. symbols
  18.     message     startup
  19.     message     activate
  20.  
  21.     thing       player0
  22.     thing        callbutton                              //calls elevator to level
  23.     thing        upbutton                                //sends elevator up
  24.     thing        dnbutton                                //sends elevator down
  25.                                            
  26.     thing        elevator                                //currently handles only one elevator
  27.                                            
  28.     float        speed=5.0                  
  29.     float       butspeed=3                              //sets speed default is 5
  30.     float        floorlevel=0.0                          //sets floor level for each cog
  31.     float        totalfloors=0.0                         //lastfloor + 1
  32.     sound        callbutt                                //button sounds
  33.     sound        updnbutt                   
  34.     sound       elevsound                           
  35.                                            
  36.     int            switch                        local       //check variable for cog internal use
  37.     int            bnosound=0                    local
  38.     int         upsound=0                   local
  39.     int         dnsound=0                   local
  40.     int         elevchan                    local
  41.     int         wepnum=1                    local
  42.     int         lastrand=-1                 local
  43.     int         currand=0                   local
  44.     
  45.     sound       indylineb0=inxj058.wav      local
  46.     sound       indylineb1=inxj059.wav      local
  47.     sound       indylineb2=inxj060.wav      local
  48.     sound       indylineb3=inxj061.wav      local
  49.     sound       indylineb4=inxj090.wav      local
  50.     sound       indylineb5=inxj095.wav      local
  51.     
  52. end
  53.  
  54. # ........................................................................................
  55.  
  56. code
  57. startup:
  58.     player0 = GetLocalPlayerThing();
  59.     return;
  60.  
  61. # ........................................................................................
  62. activate:
  63.    switch = GetSenderRef();
  64.    if ((GetCurFrame(elevator) == floorlevel) &&       //if elevator is at the current floor
  65.        (switch == callbutton) &&
  66.        (GetCurItem(player0) == 0))
  67.    {
  68.        StopThing(player0);
  69.        SetActorFlags(player0, 0x200000);
  70.        StartCutscene(0);
  71.        While(wepnum !=0)
  72.        {
  73.            wepnum = GetCurWeapon(player0);
  74.            DeselectWeaponWait(player0);
  75.            DeselectWeapon(player0);
  76.            printint(wepnum);
  77.        }    
  78.        MoveToFrame(callbutton, 1, butspeed);
  79.        MoveToFrame(callbutton, 0, butspeed);
  80.        WaitForStop(callbutton);
  81.        EndCutscene(0);
  82.        ClearActorFlags(player0, 0x200000);
  83.        wepnum = 1;
  84.    }
  85.    else if ((switch == callbutton) &&                         //if callbutton is pushed
  86.             (bnosound == 0) &&
  87.             (GetCurItem(player0) == 0))
  88.         {
  89.             bnosound = 1;
  90.             SetActorFlags(player0, 0x200000);
  91.             StartCutscene(0);
  92.             StopThing(player0);
  93.             While(wepnum !=0)
  94.             {
  95.                 wepnum = GetCurWeapon(player0);
  96.                 DeselectWeaponWait(player0);
  97.                 DeselectWeapon(player0);
  98.                 printint(wepnum);
  99.             }
  100.             PlayMode(player0, 60, 0);        // changed from 58
  101.             PlaySoundThing(callbutt, callbutton, 0.35, 3, 10, 0 );
  102.             MoveToFrame(callbutton, 1, butspeed);
  103.             WaitForStop(callbutton);
  104.             Sleep(0.5);
  105.             MoveToFrame(elevator,floorlevel,speed);
  106.             elevchan = PlaySoundLocal(elevsound, 0.5, 0, 0x0001, 0);
  107.             WaitForStop(elevator);
  108.             StopSound(elevchan, 0);
  109.             MoveToFrame(callbutton, 0, butspeed);
  110.             bnosound = 0;
  111.             wepnum=1;
  112.             EndCutscene();
  113.             ClearActorFlags(player0, 0x200000);
  114.         }
  115.    else if ((switch == upbutton) &&                        //if upbutton is pushed
  116.             (floorlevel == GetCurFrame(elevator)) &&
  117.             (GetCurFrame(elevator) < totalfloors) &&
  118.             (upsound == 0) &&
  119.             (GetCurItem(player0) == 0))
  120.         {
  121.             upsound = 1;
  122.             StartCutscene(0);
  123.             SetActorFlags(player0, 0x200000);
  124.             StopThing(player0);
  125.             While(wepnum !=0)
  126.             {
  127.                 wepnum = GetCurWeapon(player0);
  128.                 DeselectWeaponWait(player0);
  129.                 DeselectWeapon(player0);
  130.                 printint(wepnum);
  131.             }
  132.             PlayMode(player0, 60, 0);              // changed from 58
  133.             PlaySoundThing(updnbutt, upbutton, 0.35, 3, 10, 0 );
  134.             MoveToFrame(upbutton, 1, butspeed);
  135.             WaitForStop(upbutton);
  136.             Sleep(0.5);
  137.             MoveToFrame(elevator,(floorlevel+1),speed);
  138.             elevchan = PlaySoundLocal(elevsound, 0.5, 0, 0x0001, 0);
  139.             WaitForStop(elevator);
  140.             StopSound(elevchan, 0);
  141.             upsound = 0;
  142.             wepnum=1;
  143.             MoveToFrame(upbutton, 0, butspeed);
  144.             WaitForStop(upbutton);
  145.             EndCutscene();
  146.             ClearActorFlags(player0, 0x200000);
  147.         }
  148.    else if ((switch == dnbutton) &&                        //if down button is pushed
  149.             (floorlevel == GetCurFrame(elevator)) &&
  150.             (floorlevel > 0) &&
  151.             (dnsound == 0) &&
  152.             (GetCurItem(player0) == 0))
  153.         {
  154.          dnsound = 1;
  155.          StartCutscene(0);
  156.          SetActorFlags(player0, 0x200000);
  157.          StopThing(player0);
  158.          While(wepnum !=0)
  159.          {
  160.             wepnum = GetCurWeapon(player0);
  161.             DeselectWeaponWait(player0);
  162.             DeselectWeapon(player0);
  163.             printint(wepnum);
  164.          }
  165.          PlayMode(player0, 60, 0);            // changed from 58
  166.          PlaySoundThing(updnbutt, dnbutton, 0.35, 3, 10, 0 );
  167.          MoveToFrame(dnbutton, 1, butspeed);
  168.          WaitForStop(dnbutton);
  169.          Sleep(0.5);
  170.          MoveToFrame(elevator, (floorlevel-1), speed);
  171.          elevchan = PlaySoundLocal(elevsound, 0.5, 0, 0x0001, 0);
  172.          WaitForStop(elevator);
  173.          StopSound(elevchan, 0);
  174.          MoveToFrame(dnbutton, 0, butspeed);
  175.          dnsound = 0;
  176.          wepnum = 1;
  177.          WaitForStop(dnbutton);
  178.          EndCutscene();
  179.          ClearActorFlags(player0, 0x200000);
  180.         }
  181.    
  182.     if ((GetCurItem(player0) != 0) && (GetSenderID() == 1))
  183.     {
  184.         
  185.         StartCutscene(0);
  186.         SetActorFlags(player0, 0x200000);
  187.         StopThing(player0);
  188.         currand = RandBetween(0, 5);
  189.         While (lastrand == currand)
  190.         {
  191.             currand = RandBetween(0, 5);
  192.         }
  193.         PlayVoice(player0, indylineb0[currand], 1, 1);
  194.         lastrand = currand;
  195.         EndCutscene();
  196.         ClearActorFlags(player0, 0x200000);
  197.     }     
  198.     
  199.         return;
  200.  
  201. # ........................................................................................
  202.  
  203. end
  204.  
  205.  
  206.